package com.sgb.kjwl.view.ui.fragment.enterprise;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.google.android.material.tabs.TabLayout;
import com.google.gson.Gson;
import com.sgb.kjwl.AppLazyFragment;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentServicelistBinding;

import com.sgb.kjwl.model.entity.ParentAreaEntity;
import com.sgb.kjwl.model.entity.enterprise.IpPickSelectEntity;
import com.sgb.kjwl.model.entity.enterprise.SecerTitleEntity;
import com.sgb.kjwl.model.entity.enterprise.ServiceListEntiy;
import com.sgb.kjwl.model.entity.transport.GoodsSourceLocationEntity;
import com.sgb.kjwl.model.entity.user.AddressEntity;
import com.sgb.kjwl.utils.DialogFunction;
import com.sgb.kjwl.utils.PickPriceUtils;
import com.swgk.core.util.UserOperating;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.LoginEvent;
import com.sgb.kjwl.view.ui.activity.manage.WebsiteInfoActivity;
import com.sgb.kjwl.view.ui.activity.self.authentication.CertificationActivity;
import com.sgb.kjwl.view.ui.activity.self.userInfo.VerificationCodeLoginActivity;
import com.sgb.kjwl.view.ui.adapter.enterprise.ServiceListAdpater;
import com.sgb.kjwl.view.widget.IpPopWindow;
import com.sgb.kjwl.view.widget.ServiceCityPopWindow;
import com.sgb.kjwl.view.widget.ThreeLevelAreaWindow;
import com.sgb.kjwl.viewmodel.enterprise.ServiceViewModel;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.util.ClickUtils;
import com.swgk.core.util.MToast;
import com.swgk.core.util.SharedPreferenceUtil;
import com.swgk.core.xrecyclerview.XRecyclerView;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ServiceFragment extends AppLazyFragment {


    ServiceViewModel viewModel;

    private FragmentServicelistBinding binding;
    private ServiceListAdpater epQuoteAdapter;

    //    private ServicePopWindow servicePopWindow;
    private ServiceCityPopWindow cityPopWindow2;
    private List<ParentAreaEntity<List<ParentAreaEntity>>> listService;
    private String serviceClass;
    private List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> cityDatas;
    private String parentNo = "";
    private String childNo = "";
    private boolean isChange2;
    private boolean isChange1;
    private boolean isChange3;
    private boolean isChange4 = true;
    private Map<String, Object> map;
    private ThreeLevelAreaWindow mAddressPop;


    private IpPopWindow teamForEnterpisePopWindow_price;
    private IpPopWindow teamForEnterpisePopWindow_sendtype;
    private List<IpPickSelectEntity> priceDatas = new ArrayList<>();
    private List<IpPickSelectEntity> publishTypeDatas = new ArrayList<>();
    //首页选中的服务分类
    private SecerTitleEntity choice_entry;
    private int index_tab_one = 0;
    private int index_tab_tow = 0;

    public static ServiceFragment newInstance(List<ParentAreaEntity<List<ParentAreaEntity>>> list, String serviceClass) {
        ServiceFragment fragment = new ServiceFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list", (Serializable) list);
        bundle.putString("serviceClass", serviceClass);
        fragment.setArguments(bundle);
        return fragment;
    }


    public static ServiceFragment newInstance(List<ParentAreaEntity<List<ParentAreaEntity>>> list, String serviceClass, SecerTitleEntity entity) {
        ServiceFragment fragment = new ServiceFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list", (Serializable) list);
        bundle.putSerializable("entity", (Serializable) entity);
        bundle.putString("serviceClass", serviceClass);
        fragment.setArguments(bundle);
        return fragment;
    }


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater, R.layout.fragment_servicelist, container, false);
        viewModel = new ViewModelProvider(this).get(ServiceViewModel.class);
        binding.setVariable(BR.viewModel, viewModel);
        binding.setLifecycleOwner(this);
        return binding.getRoot();
    }


    @Override
    protected void initView() {
        super.initView();
        listService = (List<ParentAreaEntity<List<ParentAreaEntity>>>) getArguments().getSerializable("list");
        serviceClass = (String) getArguments().getSerializable("serviceClass");
        choice_entry = (SecerTitleEntity) getArguments().getSerializable("entity");
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }

        map = new HashMap<>();
        map.put("type", "1");
        binding.rlCategory.setOnClickListener(this);
        binding.rlCity.setOnClickListener(this);
        binding.rlPrice.setOnClickListener(this);
        binding.rlSendtype.setOnClickListener(this);
        binding.displayView.setLayoutManager(new LinearLayoutManager(getActivity()));
        epQuoteAdapter = new ServiceListAdpater(getActivity(), new ArrayList<>());
        binding.displayView.setAdapter(epQuoteAdapter);
        binding.displayView.setLoadingListener(new XRecyclerView.LoadingListener() {
            @Override
            public void onRefresh() {
                viewModel.getProfessQuoteList(false, map);
                binding.displayView.refreshComplete();
            }

            @Override
            public void onLoadMore() {
                viewModel.getProfessQuoteList(true, map);
                binding.displayView.loadMoreComplete();

            }
        });
        epQuoteAdapter.setOnItemClick(new AdapterOnItemClick<ServiceListEntiy>() {
            @Override
            public void onItemClick(ServiceListEntiy serviceListEntiy, int position) {
                if (position != -1) {//点击详情
                    WebsiteInfoActivity.start(getActivity(), serviceListEntiy.getNo(), serviceListEntiy.getPromulgatorType() == 1 ? WebsiteInfoActivity.WEBSITE_FOR_COMPANY : WebsiteInfoActivity.WEBSITE_FOR_TEAM);
                } else {//点击关注
                    if (!ClickUtils.isDoubleClick()) {
                        if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                            VerificationCodeLoginActivity.start(getActivity());
                            return;
                        }


                        if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                            com.sgb.kjwl.utils.DialogHelper.showDialog(getActivity(), "温馨提示", "请先完成实名认证", "去认证", new DialogFunction() {
                                @Override
                                public void normalRoundDialog() {
                                    CertificationActivity.start(getActivity(), "1");
                                }
                            });
                            return;
                        }
                        if(UserOperating.getInstance().isCompany()){
                            MToast.showLongToast(getActivity(),"功能正在优化中！");
                        }
                        viewModel.setFollow(serviceListEntiy.getNo(), serviceListEntiy.getPromulgatorType());
                    }
                }
            }
        });



        if (listService == null || listService.size() == 0) {
            listService = new ArrayList<>();
            binding.tabLayout1.setVisibility(View.GONE);
            binding.lin1.setVisibility(View.GONE);
        } else {
            ParentAreaEntity parentAreaEntity = new ParentAreaEntity();
            parentAreaEntity.setName("全部");
            parentAreaEntity.setId("");

            for (int i = 0; i < listService.size(); i++) {
                if (listService.get(i).getChildren() != null && listService.get(i).getChildren().size() > 0) {
                    listService.get(i).getChildren().add(0, parentAreaEntity);
                }
            }
            listService.add(0, parentAreaEntity);
            binding.tabLayout1.setVisibility(View.VISIBLE);
            for (int i = 0; i < listService.size(); i++) {
                TabLayout.Tab tab1 = binding.tabLayout1.newTab().setText(listService.get(i).getName()).setTag(i);

                if (choice_entry != null) {
                    if ((choice_entry.getCategorySecondId() + "").equals(listService.get(i).getId())) {
                        index_tab_one = i;
                        parentNo = listService.get(index_tab_one).getId();
//                        tab1.select();
                        if (listService.get(i).getChildren() != null && listService.get(i).getChildren().size() > 0) {
                            binding.tabLayout2.setVisibility(View.VISIBLE);
                            binding.lin2.setVisibility(View.VISIBLE);
                            for (int i1 = 0; i1 < listService.get(i).getChildren().size(); i1++) {

                                TabLayout.Tab tab = binding.tabLayout2.newTab().setText(listService.get(i).getChildren().get(i1).getName()).setTag(i1);
                                if ((choice_entry.getCategoryThirdId() + "").equals(listService.get(i).getChildren().get(i1).getId())) {
                                    index_tab_tow = i1;
                                    childNo = listService.get(i).getChildren().get(i1).getId();
//                                    tab.select();
                                }
                                binding.tabLayout2.addTab(tab);
                            }
                        } else {
                            binding.tabLayout2.setVisibility(View.GONE);
                            binding.lin2.setVisibility(View.GONE);
                        }
                    }
                }

                binding.tabLayout1.addTab(tab1);
            }
            if (index_tab_one != 0 && choice_entry != null) {
                binding.tabLayout1.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        binding.tabLayout1.getTabAt(index_tab_one).select();

                    }
                }, 100);


            }

        }
        //城市
        cityPopWindow2 = new ServiceCityPopWindow(getActivity());
        cityPopWindow2.setBgView(binding.grayLayout);
        cityPopWindow2.setOnResultClick((key1, key2, key3) -> {
            isChange2 = !key2.equals("") || !key3.equals("不限");
            try {
                int[] num = new int[2];
                if (!TextUtils.isEmpty(key1 + "")) {
                    num[0] = Integer.parseInt(key1 + "");
                }
                if (!TextUtils.isEmpty(key2 + "")) {
                    num[1] = Integer.parseInt(key2 + "");
                }
                map.put("provinceCode", num);
                viewModel.getProfessQuoteList(false, map);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        cityPopWindow2.setOnDisMissClick(() -> {
            if (isChange2) {
                binding.rlCity.contentSelectRed(true, false);
            } else {
                binding.rlCity.contentSelectRed(false, false);
            }
        });

        mAddressPop = new ThreeLevelAreaWindow(getActivity());
        mAddressPop.setMemberHeight();
        mAddressPop.setCitySingle();
        mAddressPop.setProvinceSingle();
        mAddressPop.setShowSimpleName(true);
        mAddressPop.setOnlyShowProAndCity(true);
        mAddressPop.setAllSingleSelect(true);
        mAddressPop.setThreeListIsGone(true);
        mAddressPop.setBgView(binding.grayLayout);
        mAddressPop.setOnResultClick(new ThreeLevelAreaWindow.OnResultClickProxy() {
            @Override
            protected void result(GoodsSourceLocationEntity entity) {
                try {
                    if (entity.getProvinceNo() == null || entity.getProvinceNo().equals("")) {
                        isChange2 = false;
                        map.remove("provinceCode");
                        viewModel.getProfessQuoteList(false, map);
                        return;
                    }
                    isChange2 = (entity.getProvinceNo() != null && !entity.getProvinceNo().equals("")) || (entity.getCityNo() != null && !entity.getCityNo().equals("")) || (entity.getCityName() != null && !entity.getCityName().equals("不限"));
                    int[] num = new int[2];
                    if (!TextUtils.isEmpty(entity.getProvinceNo())) {
                        num[0] = Integer.parseInt(entity.getProvinceNo());
                    }
                    if (!TextUtils.isEmpty(entity.getCityNo())) {
                        num[1] = Integer.parseInt(entity.getCityNo());
                    }
                    map.put("provinceCode", num);
                    viewModel.getProfessQuoteList(false, map);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        mAddressPop.setOnDismissListener(() -> {
            if (isChange2) {
                binding.rlCity.contentSelectRed(true, false);
            } else {
                binding.rlCity.contentSelectRed(false, false);
            }
        });

        teamForEnterpisePopWindow_price = new IpPopWindow(getActivity());
        teamForEnterpisePopWindow_price.setOnResultClick((type, key2, key3) -> {
            viewModel.getProfessQuoteList(false, PickPriceUtils.pickPrice(map, (IpPickSelectEntity) type));
            if (!((IpPickSelectEntity) type).getName().equals("不限")) {
                isChange3 = true;
                setTextViewBg(binding.rlPrice, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange3 = false;
                setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlPrice, 2);
            }
        });
        teamForEnterpisePopWindow_price.setOnDismissListener(() -> {
            if (!isChange3) {
                setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlPrice, 2);
            } else {
                setDrwImage(binding.rlPrice, 1);
            }
        });

        teamForEnterpisePopWindow_sendtype = new IpPopWindow(getActivity());
        teamForEnterpisePopWindow_sendtype.setOnResultClick((type, key2, key3) -> {
            //发布类型
            map.put("type", ((IpPickSelectEntity) type).getPublishType());
            viewModel.getProfessQuoteList(false, map);
            if (!((IpPickSelectEntity) type).getName().equals("不限")) {
                isChange4 = true;
                setTextViewBg(binding.rlSendtype, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
            } else {
                isChange4 = false;
                setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlSendtype, 2);
            }
        });

        teamForEnterpisePopWindow_sendtype.setDefItem(0);
        teamForEnterpisePopWindow_sendtype.setOnDismissListener(() -> {
            if (!isChange4) {
                setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.ic_down_arrow_n, R.color.color_333333);
                setDrwImage(binding.rlSendtype, 2);
            } else {
                setDrwImage(binding.rlSendtype, 1);
            }
        });
        setTextViewBg(binding.rlSendtype, R.drawable.search_new_blue_bg, R.mipmap.icon_down_red, R.color.color_main);
        teamForEnterpisePopWindow_sendtype.setBgView(binding.grayLayout);
        teamForEnterpisePopWindow_price.setBgView(binding.grayLayout);
        teamForEnterpisePopWindow_price.setBackground(R.color.white_translation);
        teamForEnterpisePopWindow_sendtype.setBackground(R.color.white_translation);
        initObsever();
    }

    @Override
    protected void onLazyLoad() {
        init();
        initTable();
    }


    private void initObsever() {

        viewModel.listdata.observe(this, listdat -> showQuoteList(listdat, viewModel.isLoadMore));
        viewModel.showpop_list.observe(this, showlis -> showMakeupPopWindow(showlis));
        viewModel.showpop_address.observe(this, listdata -> showCityPopWindow2(listdata));

        viewModel.show_Loding.observe(this, type -> {
            switch (type) {
                case 0:
                    com.swgk.core.dialog.DialogHelper.showProgressDialog(getActivity(), null, "数据加载中...", 0, false, null).setCanceledOnTouchOutside(false);
                    break;
                case 1:
                    loading();
                    break;
                case 2:
                    success();
                    break;
                case 3:
                    error();
                    break;

                case 4:
                    viewModel.getProfessQuoteList(false, map);
                    break;
            }
        });

        viewModel.show_toast.observe(this, String -> MToast.showToast(getActivity(), String));

    }


    private void initTable() {

        binding.tabLayout1.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                index_tab_one = (Integer) tab.getTag();
                parentNo = listService.get(index_tab_one).getId();
                map.put("serviceCategory", parentNo);
                map.put("serviceItem", "");
                if (listService.get(index_tab_one).getChildren() != null && listService.get(index_tab_one).getChildren().size() > 0) {
                    binding.tabLayout2.setVisibility(View.VISIBLE);
                    binding.lin2.setVisibility(View.VISIBLE);
                    binding.tabLayout2.removeAllTabs();
                    for (int i = 0; i < listService.get(index_tab_one).getChildren().size(); i++) {
                        binding.tabLayout2.addTab(binding.tabLayout2.newTab().setText(listService.get(index_tab_one).getChildren().get(i).getName()).setTag(i));
                    }
                    if (index_tab_tow != 0) {
                        binding.tabLayout2.getTabAt(index_tab_tow).select();
                        index_tab_tow = 0;
                    }

                } else {
                    childNo = "";
                    binding.tabLayout2.setVisibility(View.GONE);
                    binding.lin2.setVisibility(View.GONE);
                }
                viewModel.getProfessQuoteList(false, map);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

        binding.tabLayout2.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
//                index_tab_tow = (Integer)tab.getTag();
                childNo = listService.get(index_tab_one).getChildren().get((Integer) tab.getTag()).getId();
                map.put("serviceItem", childNo);
                viewModel.getProfessQuoteList(false, map);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

    }


    private void setDrwImage(TextView tv, int type) {
        Drawable img_off;
        Resources res = getResources();
        if (type == 0) {
            img_off = res.getDrawable(R.mipmap.icon_up_red);
        } else if (type == 1) {
            img_off = res.getDrawable(R.mipmap.icon_down_red);
        } else {
            img_off = res.getDrawable(R.mipmap.ic_down_arrow_n);
        }
        img_off.setBounds(0, 0, img_off.getMinimumWidth(), img_off.getMinimumHeight());
        tv.setCompoundDrawables(null, null, img_off, null); //设置右图标
    }

    private void setTextViewBg(TextView textView, int bg, int img, int textColor) {
        textView.setBackground(getResources().getDrawable(bg));
        Drawable drawable_n = getResources().getDrawable(img);
        drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(), drawable_n.getMinimumHeight());
        textView.setCompoundDrawables(null, null, drawable_n, null);
        textView.setTextColor(getResources().getColor(textColor));
    }

    private void init() {
        map.put("serviceClass", serviceClass);
        if (!TextUtils.isEmpty(parentNo)) {
            map.put("serviceCategory", parentNo);
        }
        if (!TextUtils.isEmpty(childNo)) {
            map.put("serviceItem", childNo);
        }
        viewModel.getProfessQuoteList(false, map);

        List<IpPickSelectEntity> onlyDatas = new ArrayList<>();
        IpPickSelectEntity entity = new IpPickSelectEntity();

        entity = new IpPickSelectEntity();
        entity.setName("企业");
        entity.setPublishType("1");
        onlyDatas.add(entity);

        entity = new IpPickSelectEntity();
        entity.setName("团队");
        entity.setPublishType("2");
        onlyDatas.add(entity);


        this.publishTypeDatas = onlyDatas;

    }

    /**
     * 专业报价数据
     *
     * @param list
     * @param isLoadMore
     */
    public void showQuoteList(List<ServiceListEntiy> list, boolean isLoadMore) {
        Log.e("message",new Gson().toJson(list));
        binding.displayView.refreshComplete();
        if (isLoadMore) {
            if (null != list && list.size() > 0) {
                binding.displayView.loadMoreComplete();
                epQuoteAdapter.addDatas(list);
            } else {
                binding.displayView.setNoMore(true);
            }
            binding.displayView.setVisibility(View.VISIBLE);
        } else {
            binding.displayView.refreshComplete();
            if (null != list && list.size() > 0) {
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.GONE);
                epQuoteAdapter.setDatas(list);
                binding.displayView.setLoadingMoreEnabled(true);
            } else {
                epQuoteAdapter.setDatas(list);
                binding.displayView.setVisibility(View.VISIBLE);
                binding.errorView.setVisibility(View.VISIBLE);
            }
        }
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.rl_category:
//                binding.rlCategory.contentSelectRed(false, true);
//                servicePopWindow.showPopwindow(binding.roomLayout, 0, 0);
                break;
            case R.id.rl_city:
                binding.rlCity.contentSelectRed(true, true);
                if (cityDatas == null) {
                    viewModel.getServiceCity();
                } else {
                    mAddressPop.showPopwindow0(binding.roomLayout);
//                    cityPopWindow2.showPopwindow(binding.roomLayout, 0, 0);
                }
                break;

            case R.id.rl_sendtype://发布类型
                if (!isChange4) {
                    if (!teamForEnterpisePopWindow_sendtype.isShowing()) {
                        setTextViewBg(binding.rlSendtype, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.rlSendtype, 0);
                    }
                } else {
                    if (!teamForEnterpisePopWindow_sendtype.isShowing()) {
                        setDrwImage(binding.rlSendtype, 0);
                    }
                }
                if (null != publishTypeDatas && publishTypeDatas.size() > 0) {
                    teamForEnterpisePopWindow_sendtype.setData(publishTypeDatas);
                    teamForEnterpisePopWindow_sendtype.showPopwindow(binding.roomLayout, 0, 0);
                }
//                binding.rlSendtype.contentSelectRed(false, true);
//                teamForEnterpisePopWindow_sendtype.showPopwindow(binding.roomLayout, 0, 0);
                break;
            case R.id.rl_price://服务价格
                if (!isChange3) {
                    if (!teamForEnterpisePopWindow_price.isShowing()) {
                        setTextViewBg(binding.rlPrice, R.drawable.search_bg, R.mipmap.icon_down_red, R.color.color_main);
                        setDrwImage(binding.rlPrice, 0);
                    }
                } else {
                    if (!teamForEnterpisePopWindow_price.isShowing()) {
                        setDrwImage(binding.rlPrice, 0);
                    }
                }
                if (null != priceDatas && priceDatas.size() > 0) {
                    teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
                } else {
                    viewModel.getPriceOptionByNo(1);
                }
//                binding.rlPrice.contentSelectRed(false, true);
//                teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
                break;
        }
    }

    public void showMakeupPopWindow(List<IpPickSelectEntity> makeupDatas) {
        List<IpPickSelectEntity> listChange = new ArrayList<>();
        listChange = PickPriceUtils.showPriceList(makeupDatas);
        this.priceDatas = listChange;
        teamForEnterpisePopWindow_price.showPopwindow(binding.roomLayout, 0, 0);
        teamForEnterpisePopWindow_price.setData(listChange);
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(LoginEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_PROFESSIONAL_QUOTE_FRG_JUMP) {
            viewModel.getProfessQuoteList(false, map);
        }
    }

    public void showCityPopWindow2(List<AddressEntity<List<AddressEntity<List<AddressEntity>>>>> cityDatas) {
        this.cityDatas = cityDatas;
        mAddressPop.setData(cityDatas, true);
        mAddressPop.showPopwindow0(binding.roomLayout);

    }


}
